package com.pinapel.aixml.ui;

import java.awt.BorderLayout;

import javax.swing.JPanel;

import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
import org.fife.ui.rsyntaxtextarea.SyntaxConstants;
import org.fife.ui.rtextarea.RTextScrollPane;

import com.pinapel.aixml.controller.LogInfoVerboseController;

public class LogInfoVerboseUI extends JPanel{
	/**
	 * 
	 */
	private static final long serialVersionUID = 53046858874224397L;
	private RTextScrollPane theScroll;
	/** */
	private RSyntaxTextArea mText;
	/** */
	private LogInfoVerboseController mController;
	
	public LogInfoVerboseUI(){
		this.setLayout(new BorderLayout());
		
		this.mText = new RSyntaxTextArea();

		this.mText.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_XML);
		this.mText.setCodeFoldingEnabled(false);
		this.mText.setAntiAliasingEnabled(true);
		this.mText.setEditable(false);
		
		this.theScroll = new RTextScrollPane(this.mText);
		this.theScroll.setFoldIndicatorEnabled(false);
		this.theScroll.setViewportView(mText);
		this.add(theScroll);
	}
	
	/**
	 * Assign the text in parameter to the text field
	 * @param text
	 */
	public void setText(String text){
		mText.setText(text);
	}
	
	/**
	 * Returns the text allocated in the text field
	 * @return a String with the text
	 */
	public String getText(){
		return mText.getText();
	}
	
	/**
	 * Returns the container of the text
	 * @return a Object RSyntaxtTextArea containing the text
	 */
	public RSyntaxTextArea getTextArea(){
		return mText;
	}
	
	/**
	 * Establish the controller to this view
	 * @param controller
	 */
	public void setController(LogInfoVerboseController controller){
		mController = controller;
	}
	
	/**
	 * Returns the current controller for this view
	 * @return the current controller for this view
	 */
	public LogInfoVerboseController getController(){
		return mController;
	}
}
